<template>
  <div>
    <div class="allinfo">
      <div class="allinfonum">
        <div
          class="el-icon-document"
          style="font-size: 60px; color: #1296db"
        ></div>
        <div>
          <h4>总订单</h4>
          <p>{{ arr.num1 }}</p>
        </div>
      </div>
      <div class="allinfonum">
        <div
          class="el-icon-school"
          style="font-size: 60px; color: #d4237a"
        ></div>
        <div>
          <h4>总销售额</h4>
          <p>{{ arr.num2 }}</p>
        </div>
      </div>
      <div class="allinfonum">
        <div
          class="el-icon-s-order"
          style="font-size: 60px; color: #1296db"
        ></div>
        <div>
          <h4>今日订单数量</h4>
          <p>{{ arr.num3 }}</p>
        </div>
      </div>
      <div class="allinfonum">
        <div
          class="el-icon-trophy"
          style="font-size: 60px; color: #1afa29"
        ></div>
        <div>
          <h4>今日销售额</h4>
          <p>{{ arr.num4 }}</p>
        </div>
      </div>
    </div>
    <div id="allearch"></div>
  </div>
</template>

<script>
import * as echarts from "echarts";
export default {
  data() {
    return {
      arr: {
        num1: 1231561,
        num2: 1615165,
        num3: 131685312,
        num4: 1651321,
      },
    };
  },
  mounted() {
    var chartDom = document.getElementById("allearch");
    var myChart = echarts.init(chartDom);
    var option;

    option = {
      title: {
        text: "折线图堆叠",
      },
      tooltip: {
        trigger: "axis",
      },
      legend: {
        data: ["邮件营销", "联盟广告", "视频广告", "直接访问", "搜索引擎"],
      },
      grid: {
        left: "3%",
        right: "4%",
        bottom: "3%",
        containLabel: true,
      },
      toolbox: {
        feature: {
          saveAsImage: {},
        },
      },
      xAxis: {
        type: "category",
        boundaryGap: false,
        data: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"],
      },
      yAxis: {
        type: "value",
      },
      series: [
        {
          name: "邮件营销",
          type: "line",
          stack: "总量",
          data: [120, 132, 101, 134, 90, 230, 210],
        },
        {
          name: "联盟广告",
          type: "line",
          stack: "总量",
          data: [220, 182, 191, 234, 290, 330, 310],
        },
        {
          name: "视频广告",
          type: "line",
          stack: "总量",
          data: [150, 232, 201, 154, 190, 330, 410],
        },
        {
          name: "直接访问",
          type: "line",
          stack: "总量",
          data: [320, 332, 301, 334, 390, 330, 320],
        },
        {
          name: "搜索引擎",
          type: "line",
          stack: "总量",
          data: [820, 932, 901, 934, 1290, 1330, 1320],
        },
      ],
    };

    option && myChart.setOption(option);
  },
};
</script>


<style lang="less" scoped>
.allinfo {
  display: flex;
  justify-content: space-between;
  margin-bottom: 50px;

  .allinfonum {
    background: #fff;
    padding: 10px 30px;
    display: flex;
    justify-content: space-between;
    width: 200px;
    h4 {
      color: #d4d4d4;
      margin-bottom: 10px;
      font-size: 18px;
    }
    p {
      text-align: center;
      font-size: 14px;
      font-weight: bold;
    }
  }
}
#allearch {
  height: 500px;

  background: #fff;
}
</style>

